import type { LoginParams, LoginResult } from './model/userModel'
import { defHttp } from '@/utils/http/axios'

import type { ErrorMessageMode } from '@/types/axios'
import { ContentTypeEnum } from '@/enums/httpEnum'

enum Api {
  Login = '/user/login/admin',
}

/**
 * @description: user login api
 */
export function loginApi(params: LoginParams, mode: ErrorMessageMode = 'modal') {
  return defHttp.post<LoginResult>({ url: Api.Login, params, headers: { 'Content-Type': ContentTypeEnum.FORM_DATA } }, { errorMessageMode: mode })
}
